<%= form.fields_for(:project_credential_provider) do |fields| %>
  <%= fields.collection_select(
    :provider_id,
    selectable_providers,
    :id,
    :friendly_name,
    { 
      include_blank: selectable_providers.count >= 1,
      selected: selectable_providers.count == 1 ? selectable_providers.first.id : nil
    },
    {
      class: "select select-bordered w-full",
      required: true,
      data: {
        "new-project-target": "provider",
        action: "change->new-project#selectProvider",
      }
    },
  ) %>
<% end %>
<div class="label">
  <span class="label-text-alt">* Required</span>
  <span class="label-text-alt"><%= link_to "+ Add Credentials", providers_path, class: "hover:underline", target: "_blank" %></span>
</div>